package com.example.aop;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class ProxyWithAnnotation {

    @Pointcut("execution(* com.example.aop.*.*(..))")
    public void pt1(){

    }

    @Before("pt1()")
    public void beforeTest(){
        System.out.println("before(Annotation)");
    }

    @After("pt1()")
    public void afterTest(){
        System.out.println("after(Annotation)");
    }

 /*   @Around("pt1()")
    public Object aroundTest(){
        System.out.println("around");
        return "11";
    }*/

    @AfterReturning("pt1()")
    public void afterReturningTest(){
        System.out.println("afterReturning");
    }

    @AfterThrowing("pt1()")
    public void afterThrowing(){
        System.out.println("你好,异常");
    }

}
